4. Using selfdestruct
5. Sending Ether via calls
6. Calling any function not marked as view or pure
7. Using low-level calls
Refer to the following code:
// SPDX-License-Identifier: SOME IDENTIFIER
pragma solidity ^0.8.10;
contract ViewContract {
uint a = 10;
uint b = 2;
function addition() public view returns(uint) {
return a + b;
}
}
2.5.16 Pure Function
In a function marked with a pure keyword, we do not update the
state variables, and don’t even read them.
Refer to the following code:
// SPDX-License-Identifier: SOME IDENTIFIER
pragma solidity ^0.8.10;
contract ViewContract {
function addition() public pure returns(uint) {
uint a = 10;
uint b = 2;
return a + b;
}
}
Please note that running the view and pure functions would not
involve any gas cost. However, if they are called from another
function, then the cost would be there.